
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/12/3
  Time: 8:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>管理员界面</title>
</head>
<body>
<button><a href="adduser.jsp">新建用户</a></button>
<br>
<button><a href="deluser.jsp">删除用户</a></button>
<br>
<button><a href="updateuser.jsp">更新用户</a></button>
<br>
<button><a href="index.jsp">返回首页</a></button>
<br>
<form method="post" action="selectAll">
    <input type="submit" value="查看所有用户"></input>
</form>
<div class="container">



    <c:if test="${not empty users}">
    <table class="layui-table">
        <thead>
        <tr>
            <th>ID</th>
            <th>姓名</th>
            <th>性别</th>
            <th>班级</th>
            <th>爱好</th>
        </tr>
        </thead>
        <tbody>
        <br>
        <c:forEach var="user" items="${users}">
            <tr>
                <td>${user.id}</td>
                <td>${user.username}</td>
                <td>${user.sex}</td>
                <td>${user.group}</td>

                <td>
                    <c:if test="${not empty user.likes[0]}">
                        ${user.likes[0]}
                    </c:if>
                    <c:if test="${not empty user.likes[1]}">
                        ,${user.likes[1]}
                    </c:if>
                    <c:if test="${not empty user.likes[2]}">
                        ,${user.likes[2]}
                    </c:if><br>
                </td>
            </tr>
        </c:forEach>
        </c:if>
        </tbody>
    </table>
</div>
<style>
    table,table tr th, table tr td {
        border:1px solid #ccc;
    }
    table{
        width: 400px;
        border-collapse: collapse;
    }</style>
<span id="spanDate">

</span><script type="text/javascript">function setSpanDate(){
    var nowDate = new Date();
    document.getElementById("spanDate").innerHTML = setFull(nowDate.getHours())+":"+setFull(nowDate.getMinutes())+":"+setFull(nowDate.getSeconds());}
function setFull(num){
    if(num < 10)
        return "0" + num;
    else {
        return num;}
}window.setInterval("setSpanDate()",1000);
</script>
</body>
</html>
